<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>倒计时demo</title>
</head>
<body>
<script>
    // var startTime = 9481552440.718/1000;
    var timer = null;
    function timeFn(){
        var startTime = new Date('2016/12/12,22:33:0').getTime()/1000;
        var nowTime = new Date().getTime()/1000;
        var leftTime = parseInt(startTime - nowTime);
        var day = parseInt( leftTime/(24*60*60) );
        var hour = parseInt( leftTime/(60*60)%24 );
        var min = parseInt( leftTime/60%60 );
        var sec = parseInt( leftTime%60 );
        if( leftTime <= 0 ){
            clearTimeout(timer);
            console.log('倒计时结束');
        }else{
            timer = setTimeout(timeFn,1000);
            console.log(day,hour,min,sec);
        }
        
    }
    timeFn();

</script>
</body>
</html>